﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Triangle
{
    class Program
    {
        /// <summary>
        /// 输出三角形系列
        /// </summary>
        /// <param name="args"></param>
        static void Main(string[] args)
        {
            //输出一个直角三角形
            int Number1 = -1;
            while (Number1 <0)
            {
                Console.Write("请输入行数：");
                Number1 = int.Parse(Console.ReadLine());
            }
            if (Number1 > 0)
                for (int i = 1; i <= Number1; i++)
                {
                    for (int j = 1; j <= i; j++)
                    {
                        Console.Write("*");
                    }
                    Console.WriteLine("");
                }

            //输出一个等腰三角形
            int Number2 = -1;
            while (Number2 < 0)
            { 
                Console.Write("请输入行数：");
                Number2 = int.Parse(Console.ReadLine());
            }  
            if (Number2 > 0)
            {
                //循环行数
                for (int i = 1; i <= Number2; i++)
                {
                    //循环空格数
                    for (int j =1 ; j <=Number2-i; j++ )
                    {
                        Console.Write(" ");
                    }
                        //*个数
                    for (int k = 1; k <=2*i-1; k++)
                    {    
                        Console.Write("*");
                    } 
                    //换行
                    Console.Write("\n");
                }      
            }
            //输出一个菱形
            int Number3 = -1;
            while (Number3 < 0)
            {
                Console.Write("请输入行数：");
                Number3 = int.Parse(Console.ReadLine());
            }
            if (Number3>0)
            {
                //菱形的上半部分
                for (int i = 1; i <= Number3; i++)
                {
                    //循环空格数
                    for (int j = 1; j <= Number3 - i; j++)
                    {
                        Console.Write(" ");
                    }
                    //*个数
                    for (int k = 1; k <= 2 * i - 1; k++)
                    {
                        Console.Write("*");
                    }
                    //换行
                    Console.Write("\n");
                }
                //菱形下半部分
                for (int i = Number3-1; i>=1; i--)
                {
                    for (int j = 1; j <= Number3-i; j++)
                    {
                        Console.Write(" ");
                    }
                    for (int k = 1; k <= 2*i-1; k++)
                    {
                        Console.Write("*");
                    }
                    Console.Write("\n");
                }
            }

            //输出一个空心菱形
            int Number4 = -1;
            while (Number4 < 0)
            {
                Console.Write("请输入行数：");
                Number4 = int.Parse(Console.ReadLine());
            }
            if (Number4 > 0)
            {   
                //空心菱形上半部分
                for (int i = 1; i <=Number4; i++)
                {
                    for (int j = 1; j <= Number4-i; j++)
                    {
                        Console.Write(" ");
                    }
                    if (i == 1)
                        Console.Write("*");
                    else
                    {
                        Console.Write("*");
                        for (int k = 1; k <= 2 * i - 3; k++)
                        {
                            Console.Write(" ");
                        }
                        Console.Write("*");
                    }
                    Console.Write("\n");

                }

                //空心菱形下半部分
                for (int i = Number4 - 1; i >= 1; i--)
                {
                    for (int j = 1; j <= Number4 - i; j++)
                    {
                        Console.Write(" ");
                    }
                    if (i == 1)
                        Console.Write("*");
                    else
                    {
                        Console.Write("*");
                        for (int k = 1; k <= 2 * i - 3; k++)
                        {
                            Console.Write(" ");
                        }
                        Console.Write("*");
                    }
                    Console.Write("\n");
                }
            }       
            //程序结束
            Console.WriteLine("按任意键结束...");
            Console.ReadKey();
           


        }
}
}

